<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Route::get('/register','\App\Http\Controllers\RegisterController@index');//注册页面
Route::post('/register','\App\Http\Controllers\RegisterController@register');//注册行为
Route::get('/login','\App\Http\Controllers\LoginController@index');//登陆页面
Route::post('/login','\App\Http\Controllers\LoginController@login');//登陆行为
Route::post('/logout','\App\Http\Controllers\LoginController@logout');//退出行为

Route::get('/user/me/setting','\App\Http\Controllers\UserController@setting');//个人设置页面

Route::post('/user/me/setting','\App\Http\Controllers\UserController@settingStore');//个人设置操作

Route::prefix('posts')->group(function (){

    Route::get('/','\App\Http\Controllers\PostController@index');//文章列表
    /*创建文章页面跟文章详情页面 这种路由书写方式 创建页面必须在前面  否则 只能识别到文章详情页面-------------start-----------*/
    Route::get('/create','\App\Http\Controllers\PostController@create');//创建文章页面
    Route::get('/{post}','\App\Http\Controllers\PostController@show');//文章详情
    /*--------------------------------------end-----------------------------------------------*/
    Route::post('/','\App\Http\Controllers\PostController@store');//新增文章操作
    Route::get('/{post}/edit','\App\Http\Controllers\PostController@edit');//编辑文章页面
    Route::put('/{post}','\App\Http\Controllers\PostController@update');//编辑文章操作
    Route::get('/{post}/delete','\App\Http\Controllers\PostController@delete');//删除文章操作
    //图片上传
    route::post('/image/upload','\App\Http\Controllers\PostController@imageUpload');

});



Route::get('/home', 'HomeController@index')->name('home');
